package designpattern.flyweight.hot;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantLock;

public class HotspotDataFactory {
    private static final Map<String, R> hotMap = new ConcurrentHashMap<>();

    public static R getHotspotDataByKey(String key) throws InterruptedException {
        if (!hotMap.containsKey(key)) {
            IHotspotData instance = new HotspotData();
            R data = instance.getHotSpotData(key);
            hotMap.put(key, data);
        }
        return hotMap.get(key);
       // return new HotspotData(key).getHotSpotData();
    }
}
